<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>注册页面</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            background-color: #f5f5f5;
        }

        .header {
            background-color: #87CEEB;
            text-align: center;
            color: white;
            padding: 20px 0;
            font-size: 24px;
        }

        .register-container {
            width: 400px;
            margin: 50px auto;
            padding: 20px;
            background: #fff;
            border-radius: 8px;
            border: 1px solid pink;
        }

        .form-group {
            margin: 15px 0;
        }

        .form-group label {
            display: inline-block;
            width: 80px;
            text-align: justify;
            text-align-last: justify;
            margin-right: 10px;
        }

        .form-group label::after {
            content: ":";
            display: inline-block;
            width: 0;
            text-align: left;
        }

        .form-group input {
            width: 250px;
            padding: 5px;
            border: 1px solid #ddd;
            border-radius: 3px;
        }

        .links {
            margin: 10px 0;
            margin-left: 90px;
        }

        .links a {
            color: #87CEEB;
            text-decoration: none;
        }

        .register-btn {
            width: 100%;
            padding: 8px;
            background: #f5f5f5;
            border: 1px solid #ddd;
            border-radius: 3px;
            cursor: pointer;
            margin-top: 10px;
        }

        .password-wrapper {
            position: relative;
            display: inline-block;
            width: 250px;
        }

        .password-toggle {
            position: absolute;
            right: 8px;
            top: 50%;
            transform: translateY(-50%);
            width: 24px;
            height: 24px;
            border: none;
            background: none;
            cursor: pointer;
            padding: 0;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .password-toggle:hover svg path {
            fill: #666;
        }
    </style>
</head>
<body>
    <div class="header">
        注册页面
    </div>

    <div class="register-container">
        <div class="form-group">
            <label>用户名</label>
            <input type="text" id="username">
        </div>
        
        <div class="form-group">
            <label>密码</label>
            <div class="password-wrapper">
                <input type="password" id="password">
                <button type="button" class="password-toggle" onclick="togglePassword('password')">
                    <svg viewBox="0 0 24 24" width="16" height="16">
                        <path class="show-pwd" fill="#999" d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/>
                        <path class="hide-pwd" fill="#999" d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z" style="display: none;"/>
                    </svg>
                </button>
            </div>
        </div>

        <div class="form-group">
            <label>确认密码</label>
            <div class="password-wrapper">
                <input type="password" id="rpassword">
                <button type="button" class="password-toggle" onclick="togglePassword('rpassword')">
                    <svg viewBox="0 0 24 24" width="16" height="16">
                        <path class="show-pwd" fill="#999" d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/>
                        <path class="hide-pwd" fill="#999" d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z" style="display: none;"/>
                    </svg>
                </button>
            </div>
        </div>

        <div class="form-group">
            <label>昵称</label>
            <input type="text" id="nickname">
        </div>

        <div class="links">
            <span>已有账号，</span>
            <a href="./login.html">直接登录</a>
        </div>

        <button class="register-btn" onclick="register()">注册</button>
    </div>

    <script src="https://cdn.bootcdn.net/ajax/libs/qs/6.9.4/qs.min.js"></script>
    <script src="../lib/axios.min.js"></script>
    <script src="../js/config.js"></script>
    <script src="../js/register.js"></script>
    <script>
    function togglePassword(inputId) {
        const input = document.getElementById(inputId);
        const button = input.nextElementSibling;
        const showPath = button.querySelector('.show-pwd');
        const hidePath = button.querySelector('.hide-pwd');
        
        if (input.type === 'password') {
            input.type = 'text';
            showPath.style.display = 'none';
            hidePath.style.display = 'block';
        } else {
            input.type = 'password';
            showPath.style.display = 'block';
            hidePath.style.display = 'none';
        }
    }
    </script>
</body>
</html> 